from django.shortcuts import render
from rest_framework.views import APIView
from apps.AITongyi import get_answer
from rest_framework.response import Response


class AIAnswerAPIView(APIView):
    def post(self, request):
        user_input = request.data.get('qs')
        ret = get_answer(user_input)
        return Response({"message": "查询成功！", 'data': ret})
